package com.example.demo.controller;

import com.example.demo.entity.Result;
import com.example.demo.service.impl.FinanceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@RestController
@RequestMapping("sys/finance")
public class FinanceController {
    @Autowired
    private FinanceServiceImpl financeService;

    @GetMapping("getAllFinance")
    public Result getAllFinance(@RequestParam Map<String,Object> params, HttpServletRequest request){
        return financeService.getAllFinance(params);
    }

    @PostMapping("insertFinance")
    public Result insertFinance(@RequestBody Map<String,Object> params, HttpServletRequest request){
        return financeService.insertFinance(params);
    }

    @PostMapping("updateFinance")
    public Result updateFinance(@RequestBody Map<String,Object> params, HttpServletRequest request){
        return financeService.updateFinance(params);
    }
    @GetMapping("deleteFinance")
    public Result deleteFinance(@RequestParam Map<String,Object> params, HttpServletRequest request){
        return financeService.deleteFinance(params);
    }

    @GetMapping("getMonthFinance")
    public Result getMonthFinance(@RequestParam Map<String,Object> params, HttpServletRequest request){
        return financeService.getMonthFinance(params);
    }
    @GetMapping("getMonthFinance1")
    public Result getMonthFinance1(@RequestParam Map<String,Object> params, HttpServletRequest request){
        return financeService.getMonthFinance1(params);
    }

    @GetMapping("getExpense")
    public Result getExpense(@RequestParam Map<String,Object> params, HttpServletRequest request){
        return financeService.getExpense(params);
    }

    @PostMapping("insertExpense")
    public Result insertExpense(MultipartFile[] file, @RequestParam Map<String,Object> paramMap, HttpServletRequest request){
        return financeService.insertExpense(file,paramMap,request);
    }

    @PostMapping("deleteExpense")
    public Result insertExpense(@RequestBody Map<String,Object> paramMap, HttpServletRequest request){
        return financeService.deleteExpense(paramMap,request);
    }
}
